<?php

use yii\db\Migration;

class m130524_201442_init extends Migration
{
    public function up()
    {
        $params = $this->getParams();
        $frontendUri = "";
        isset($params['frontendUri']) && $frontendUri = $params['frontendUri'];
        while( strpos($frontendUri, 'http://') !== 0 && strpos($frontendUri, 'https://') !== 0 && strpos($frontendUri, '//') !== 0 ){
            if( $frontendUri == "" ){
                yii::$app->controller->stdout("Input your frontend web url(like http://www.xxx.com) :");
            }else {
                yii::$app->controller->stdout("Must begin with 'http', 'https' or '//' :");
            }
            $frontendUri = trim(fgets(STDIN));
        }

        $tableOptions = null;
        if ($this->db->driverName === 'mysql') {
            // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        }


        //table user
        $this->createTable('{{%user}}', [
            'id' => $this->primaryKey()->comment("自增用户id"),
            'username' => $this->string()->notNull()->unique()->comment("用户名"),
            'auth_key' => $this->string(32)->notNull()->comment("cookie验证auth_key"),
            'password_hash' => $this->string()->notNull()->comment("加密后密码"),
            'password_reset_token' => $this->string()->unique()->comment("找回密码token"),
            'email' => $this->string()->notNull()->unique()->comment("用户邮箱"),
            'avatar' => $this->string()->defaultValue('')->comment("用户头像url"),
            'status' => $this->smallInteger()->notNull()->defaultValue(10)->comment("用户状态,10为正常"),
            'created_at' => $this->integer()->notNull()->comment("创建时间"),
            'updated_at' => $this->integer()->notNull()->comment("最后修改时间"),
        ], $tableOptions);

        $this->batchInsert("{{%user}}", ['id','username','auth_key','password_hash','email','status','created_at','updated_at',],
            [
                /**[
                    '1',
                    'aaa',
                    'y-I4ci4glWqom_ZeW6IItOCWFx69FjqQ',
                    '$2y$13$h2GSh/y8qa1WU.ZRVU3VaOr2/Zfh/VxCUfLmbY4xNeZ1Ql2lbMF36',
                    'aaa@feehi.com',
                    '10',
                    '1469070407',
                    '0',
                ],
                [
                    '2',
                    'bbb',
                    '9wMhzQEqGW8h1_NFBoCYY3StQ_ZJ8UaM',
                    '$2y$13$MbDa4j1TujVid9Zk0saOYu7eGk/N52nOJjTYr22dCYRhJ/D9jV29.',
                    'bbb@feehi.com',
                    '10',
                    '1469070568',
                    '0',
                ],**/
            ]
        );


        //table admin_user
        $this->createTable('{{%admin_user}}', [
            'id' => $this->primaryKey()->unsigned()->comment("自增管理员用户id"),
            'username' => $this->string()->notNull()->unique()->comment("管理员用户名"),
            'auth_key' => $this->string(32)->notNull()->comment("管理员cookie验证auth_key"),
            'password_hash' => $this->string()->notNull()->comment("管理员加密密码"),
            'password_reset_token' => $this->string()->unique()->comment("管理员找回密码token"),
            'email' => $this->string()->notNull()->unique()->comment("管理员邮箱"),
            'avatar' => $this->string()->defaultValue('')->comment("管理员头像url"),
            'status' => $this->smallInteger()->notNull()->defaultValue(10)->comment("管理员状态,10正常"),
            'created_at' => $this->integer()->notNull()->comment("创建时间"),
            'updated_at' => $this->integer()->defaultValue(0)->notNull()->comment("最后修改时间"),
        ], $tableOptions);

        $this->batchInsert("{{%admin_user}}", ['id','username','auth_key','password_hash','email','avatar','status','created_at','updated_at'],
            [
                [
                    "1",
                    "admin",
                    "zr9mY7lt23oAhj_ZYjydbLJKcbE3FJ19",
                    "$2y$13$8aF72c/7Nqq/atyMivhVTej0bIXS1t8daPJXKtVjFzJUsG68eGgaG",
                    "admin@feehi.com",
                    "",
                    "10",
                    "1468288038",
                    "1476711945",

                ],
                /*[
                    "2",
                    "fff",
                    "1JC2paBZhxrLPXNEpGDqW8Bp130x0_g6",
                    '$2y$13$v.WxC/zKWasDR2fVZsa5u.xoVCh.8VE1QtyqCQNFrZO7DgEvZoZhS',
                    "fff@feehi.com",
                    "",
                    "10",
                    "1469087451",
                    "1476711969",

                ],**/
            ]
        );


        //table admin_log
        $this->createTable('{{%admin_log}}', [
            'id' => $this->primaryKey()->unsigned()->comment("自增id"),
            'user_id' => $this->integer()->unsigned()->notNull()->comment("管理员用户id"),
            'route' => $this->string()->defaultValue('')->notNull()->comment("操作路由"),
            'description' => $this->text()->comment("操作描述"),
            'created_at' => $this->integer()->unsigned()->notNull()->comment("创建时间"),
            'updated_at' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("最后修改时间"),
        ], $tableOptions);


        //table category
        $this->createTable('{{%category}}', [
            'id' => $this->primaryKey()->unsigned(),
            'parent_id' => $this->integer()->unsigned()->defaultValue(0)->notNull(),
            'name' => $this->string()->notNull(),
            'alias' => $this->string()->notNull(),
            'sort' => $this->integer()->unsigned()->defaultValue(0)->notNull(),
            'remark' => $this->string()->defaultValue('')->notNull(),
            'created_at' => $this->integer()->unsigned()->notNull(),
            'updated_at' => $this->integer()->unsigned()->defaultValue(0)->notNull(),
        ], $tableOptions);

        $this->batchInsert("{{%category}}", ['id','parent_id','name','alias','sort','created_at','updated_at','remark'],
            [
                [
                    '1',
                    '0',
                    'php',
                    'php',
                    '0',
                    '1468293958',
                    '0',
                    '',
                ],
                [
                    '2',
                    '0',
                    'java',
                    'java',
                    '0',
                    '1468293965',
                    '0',
                    '',
                ],
                [
                    '3',
                    '0',
                    'javascript',
                    'javascript',
                    '0',
                    '1468293974',
                    '0',
                    '',
                ],
            ]
        );


        //table article
        $this->createTable('{{%article}}', [
            'id' => $this->primaryKey()->unsigned()->comment("文章自增id"),
            'cid' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("文章分类id"),
            'type' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("类型.0文章,1单页"),
            'title' => $this->string()->notNull()->comment("文章标题"),
            'sub_title' => $this->string()->defaultValue('')->notNull()->comment("用户名"),
            'summary' => $this->string()->defaultValue('')->notNull()->comment("文章概要"),
            'thumb' => $this->string()->defaultValue('')->notNull()->comment("缩略图"),
            'seo_title' => $this->string()->defaultValue('')->notNull()->comment("seo标题"),
            'seo_keywords' => $this->string()->defaultValue('')->notNull()->comment("seo关键字"),
            'seo_description' => $this->string()->defaultValue('')->notNull()->comment("seo描述"),
            'status' => $this->smallInteger()->unsigned()->defaultValue(1)->notNull()->comment("状态.0草稿,1发布"),
            'sort' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("排序"),
            'author_id' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("发布文章管理员id"),
            'author_name' => $this->string()->defaultValue('')->notNull()->comment("发布文章管理员用户名"),
            'scan_count' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("浏览次数"),
            'comment_count' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("浏览次数"),
            'can_comment' => $this->smallInteger()->unsigned()->defaultValue(1)->notNull()->comment("是否可评论.0否,1是"),
            'visibility' => $this->smallInteger()->unsigned()->defaultValue(1)->notNull()->comment("文章可见性.1.公开,2.评论可见,3.加密文章,4.登陆可见"),
            'password' => $this->string()->defaultValue('')->notNull()->comment("文章明文密码"),
            'flag_headline' => $this->smallInteger()->unsigned()->defaultValue(0)->notNull()->comment("头条.0否,1.是"),
            'flag_recommend' => $this->smallInteger()->unsigned()->defaultValue(0)->notNull()->comment("推荐.0否,1.是"),
            'flag_slide_show' => $this->smallInteger()->unsigned()->defaultValue(0)->notNull()->comment("幻灯.0否,1.是"),
            'flag_special_recommend' => $this->smallInteger()->unsigned()->defaultValue(0)->notNull()->comment("特别推荐.0否,1.是"),
            'flag_roll' => $this->smallInteger()->unsigned()->defaultValue(0)->notNull()->comment("滚动.0否,1.是"),
            'flag_bold' => $this->smallInteger()->unsigned()->defaultValue(0)->notNull()->comment("加粗.0否,1.是"),
            'flag_picture' => $this->smallInteger()->unsigned()->defaultValue(0)->notNull()->comment("图片.0否,1.是"),
            'created_at' => $this->integer()->unsigned()->notNull()->comment("创建时间"),
            'updated_at' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("最后修改时间"),
        ], $tableOptions);

        $this->createIndex("index_title", "{{%article}}", "title");

        $this->batchInsert("{{%article}}", ['id','cid','type','title','sub_title','summary','thumb','seo_title','seo_keywords','seo_description','status','sort','author_id','author_name','scan_count','comment_count','can_comment','visibility','flag_headline','flag_recommend','flag_slide_show','flag_special_recommend','flag_roll','flag_bold','flag_picture','created_at','updated_at'],
            [
                [
                    "1",
                    "3",
                    "0",
                    "高效快速地加载 AngularJS 视图",
                    "",
                    "当AngularJS应用程序变大时，很多问题就开始显现出来了，比如多层级视图的加载问题，如果在子视图显示之前没有预加载，则可能在需要展示时，发生视觉闪烁的情况。这种问题在网络缓慢，或者服务器使用较慢的https连接时更容易出现。",
                    "/uploads/article/thumb/2016071211354628.jpg",
                    "高效快速地加载 AngularJS 视图",
                    "JavaScript, AngularJS",
                    "当AngularJS应用程序变大时，很多问题就开始显现出来了，比如多层级视图的加载问题，如果在子视图显示之前没有预加载，则可能在需要展示时，发生视觉闪烁的情况。这种问题在网络缓慢，或者服务器使用较慢的https连接时更容易出现。",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "0",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468294546",
                    "1476717356",

                ],
                [
                    "2",
                    "3",
                    "0",
                    "如何定位 Node.js 的内存泄漏",
                    "",
                    "在 《一次 Node.js 应用内存暴涨分析》中，我们处理了一个 Node.js vm 引发的内存泄漏问题，处理过程也是比较艰辛。而在我们实际开发中，可能经常会碰到内存泄漏的问题，但很多情况下，我们对于这种问题的处理是有些迷茫的，没有一定的操作流程，效率比较低。虽然这种问题对于经验的要求比较高，但如果有一个简单的排查流程，还是会有一定帮助的。",
                    "/uploads/article/thumb/201607121141407.png",
                    "",
                    "",
                    "在 《一次 Node.js 应用内存暴涨分析》中，我们处理了一个 Node.js vm 引发的内存泄漏问题，处理过程也是比较艰辛。而在我们实际开发中，可能经常会碰到内存泄漏的问题，但很多情况下，我们对于这种问题的处理是有些迷茫的，没有一定的操作流程，效率比较低。虽然这种问题对于经验的要求比较高，但如果有一个简单的排查流程，还是会有一定帮助的。",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "3",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "1",
                    "0",
                    "0",
                    "0",
                    "1468294900",
                    "1476717356",

                ],
                [
                    "3",
                    "1",
                    "0",
                    "Hack：用于HHVM的一种新编程语言",
                    "",
                    "",
                    "/uploads/article/thumb/2016071212382956.jpg",
                    "",
                    "Facebook, hack, php",
                    "",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "0",
                    "0",
                    "1",
                    "1",
                    "1",
                    "0",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "1468298309",
                    "1476717356",

                ],
                [
                    "4",
                    "3",
                    "0",
                    "抛弃jQuery，拥抱原生JavaScript",
                    "",
                    "原生javascript",
                    "/uploads/article/thumb/2016071212414099.png",
                    "抛弃jQuery，拥抱原生JavaScript",
                    "jquery,javascript,web",
                    "",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "0",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468298500",
                    "1476717356",

                ],
                [
                    "5",
                    "2",
                    "0",
                    "[JAVA · 初级]：GC-垃圾回收机制",
                    "",
                    "在C++中，对象所占的内存在程序结束运行之前一直被占用，在明确释放之前不能分配给其它对象；而在Java中，当没有对象引用指向原先分配给某个对象的内存时，该内存便成为垃圾。",
                    "/uploads/article/thumb/2016071212441669.jpg",
                    "[JAVA · 初级]：GC-垃圾回收机制",
                    "gc,垃圾回收,java",
                    "在C++中，对象所占的内存在程序结束运行之前一直被占用，在明确释放之前不能分配给其它对象；而在Java中，当没有对象引用指向原先分配给某个对象的内存时，该内存便成为垃圾。",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "0",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468298628",
                    "1476717356",

                ],
                [
                    "6",
                    "1",
                    "0",
                    "PHP 7.0.2正式版发布：WordPress速度提升3倍！",
                    "",
                    "提到PHP，肯定会有人说这是世界上最好的编程语言。",
                    "/uploads/article/thumb/2016071212472374.jpeg",
                    "PHP 7.0.2正式版发布：WordPress速度提升3倍！",
                    "php7,php,wordpress",
                    "提到PHP，肯定会有人说这是世界上最好的编程语言。",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "1",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468298843",
                    "1476717356",

                ],
                [
                    "7",
                    "3",
                    "0",
                    "为何要学HTML5开发?HTML5发展前景如何？",
                    "",
                    "",
                    "",
                    "为何要学HTML5开发?HTML5发展前景如何？",
                    "html,html5",
                    "",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "1",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468298894",
                    "1476717356",

                ],
                [
                    "8",
                    "2",
                    "0",
                    "Spring知识点提炼",
                    "",
                    "spring框架",
                    "/uploads/article/thumb/2016071212525610.jpg",
                    "Spring知识点提炼",
                    "spring,java",
                    "spring框架",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "0",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "1",
                    "0",
                    "0",
                    "0",
                    "1468299176",
                    "1476717356",

                ],
                [
                    "9",
                    "3",
                    "0",
                    "CSS代码重构与优化之路",
                    "",
                    "着项目规模的增加，项目中的CSS代码也会越来越多，如果没有及时对CSS代码进行维护，CSS代码不断会越来越多。",
                    "/uploads/article/thumb/2016071212553820.jpeg",
                    "CSS代码重构与优化之路",
                    "css,重构",
                    "着项目规模的增加，项目中的CSS代码也会越来越多，如果没有及时对CSS代码进行维护，CSS代码不断会越来越多。",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "0",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468299338",
                    "1476717356",

                ],
                [
                    "10",
                    "1",
                    "0",
                    "PHP分页技术的代码和示例",
                    "",
                    "分页是目前在显示大量结果时所采用的最好的方式。",
                    "/uploads/article/thumb/2016071212580919.png",
                    "PHP分页技术的代码和示例",
                    "php,分页,php分页",
                    "分页是目前在显示大量结果时所采用的最好的方式。",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "1",
                    "0",
                    "1",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468299489",
                    "1476717356",

                ],
                [
                    "11",
                    "1",
                    "0",
                    "10个免费下载PHP脚本的网站",
                    "",
                    "免费的PHP脚本下载",
                    "/uploads/article/thumb/2016071213000120.png",
                    "10个免费下载PHP脚本的网站",
                    "php脚本,下载,代码下载",
                    "免费的PHP脚本下载",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "4",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468299601",
                    "1476717356",

                ],
                [
                    "12",
                    "1",
                    "0",
                    "趣文：如果编程语言是女人（新编版）",
                    "",
                    "语言趣文",
                    "/uploads/article/thumb/2016071213020658.png",
                    "趣文：如果编程语言是女人（新编版）",
                    "java, Javascript, Lisp, php, Python, Ruby, 编程语言, 趣文",
                    "语言趣文",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "0",
                    "3",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "1",
                    "0",
                    "0",
                    "0",
                    "1468299726",
                    "1476717891",

                ],
                [
                    "13",
                    "3",
                    "0",
                    "浏览器缓存机制",
                    "",
                    "浏览器缓存机制，其实主要就是HTTP协议定义的缓存机制（如： Expires； Cache-control等）。",
                    "/uploads/article/thumb/2016071213054793.jpg",
                    "浏览器缓存机制",
                    "缓存,浏览器缓存,http协议",
                    "浏览器缓存机制，其实主要就是HTTP协议定义的缓存机制（如： Expires； Cache-control等）。",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "1",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468299947",
                    "1476717356",

                ],
                [
                    "14",
                    "3",
                    "0",
                    "JavaScript 统治的世界，烤面包机将能运行 JS 了",
                    "",
                    "从浏览器到手机，从平板电脑到桌面电脑，从工业自动化到最小的微控制器——最近JavaScript 似乎蔓延到了最意想不到的地方，不远的将来，你的烤面包机也将会运行 JavaScript ……。但是为什么？",
                    "",
                    "JavaScript 统治的世界，烤面包机将能运行 JS 了",
                    "javascript,流行",
                    "从浏览器到手机，从平板电脑到桌面电脑，从工业自动化到最小的微控制器——最近JavaScript 似乎蔓延到了最意想不到的地方，不远的将来，你的烤面包机也将会运行 JavaScript ……。但是为什么？",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "1",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468300042",
                    "1476717356",

                ],
                [
                    "15",
                    "2",
                    "0",
                    "给Java说句公道话",
                    "",
                    "有些人问我，在现有的语言里面，有什么好的推荐？我说：“Java。” 他们很惊讶：“什么？Java！” 所以我现在来解释一下。",
                    "/uploads/article/thumb/2016071213095350.jpg",
                    "给Java说句公道话",
                    "java",
                    "有些人问我，在现有的语言里面，有什么好的推荐？我说：“Java。” 他们很惊讶：“什么？Java！” 所以我现在来解释一下。",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "0",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468300193",
                    "1476717356",

                ],
                [
                    "16",
                    "2",
                    "0",
                    "Java编程入门（1.6）：现代用户界面",
                    "",
                    "算机刚问世时，普通人——包括大多数程序员——都不允许靠近计算机。",
                    "/uploads/article/thumb/2016071214100948.jpg",
                    "Java编程入门（1.6）：现代用户界面",
                    "java,用户界面",
                    "算机刚问世时，普通人——包括大多数程序员——都不允许靠近计算机。",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "1",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468300356",
                    "1476717356",

                ],
                [
                    "17",
                    "3",
                    "0",
                    "精简页面的样式文件，去掉不用的样式",
                    "",
                    "精简css样式",
                    "",
                    "精简页面的样式文件，去掉不用的样式",
                    "css,样式",
                    "精简css样式",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "6",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468300509",
                    "1476717356",

                ],
                [
                    "18",
                    "2",
                    "0",
                    "Java编程入门：前言",
                    "",
                    "Java编程入门》是一本使用Java作为入门语言的免费计算机编程课本",
                    "/uploads/article/thumb/2016071213165538.jpg",
                    "Java编程入门：前言",
                    "java,入门,编程书籍",
                    "Java编程入门》是一本使用Java作为入门语言的免费计算机编程课本",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "0",
                    "0",
                    "1",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468300615",
                    "1476717915",

                ],
                [
                    "19",
                    "2",
                    "0",
                    "Java 8最快的垃圾搜集器是什么？",
                    "",
                    "OpenJDK 8 有多种 GC（Garbage Collector）算法，如 Parallel GC、CMS 和 G1。哪一个才是最快的呢？如果在 Java 9 中将 Java 8 默认的 GC 从 Parallel GC 改为 G1 （目前只是建议）将会怎么样呢？让我们对此进行基准测试。",
                    "/uploads/article/thumb/2016071213182356.jpg",
                    "Java 8最快的垃圾搜集器是什么？",
                    "java,java8,垃圾收集",
                    "OpenJDK 8 有多种 GC（Garbage Collector）算法，如 Parallel GC、CMS 和 G1。哪一个才是最快的呢？如果在 Java 9 中将 Java 8 默认的 GC 从 Parallel GC 改为 G1 （目前只是建议）将会怎么样呢？让我们对此进行基准测试。",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "33",
                    "0",
                    "1",
                    "1",
                    "1",
                    "0",
                    "0",
                    "1",
                    "0",
                    "0",
                    "0",
                    "1468300703",
                    "1476717356",

                ],
                [
                    "20",
                    "2",
                    "0",
                    "使用Memcached改进Java企业级应用性能（1）：架构和设置",
                    "",
                    "Memcached由Danga Interactive开发，用来提升LiveJournal.com网站性能。Memcached分布式架构支持众多的社交网络应用，Twitter、Facebook还有Wikipedia。在接下来的两部分教程中，Sunil Patil介绍了Memcached分布式哈希表架构，以及利用它帮助你为数据驱动Java企业应用做数据缓存。",
                    "/uploads/article/thumb/201607121325288.png",
                    "使用Memcached改进Java企业级应用性能（1）：架构和设置",
                    "java,memcached",
                    "Memcached由Danga Interactive开发，用来提升LiveJournal.com网站性能。Memcached分布式架构支持众多的社交网络应用，Twitter、Facebook还有Wikipedia。在接下来的两部分教程中，Sunil Patil介绍了Memcached分布式哈希表架构，以及利用它帮助你为数据驱动Java企业应用做数据缓存。",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "1",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468300831",
                    "1476717356",

                ],
                [
                    "21",
                    "2",
                    "0",
                    "JVM的相关知识整理和学习",
                    "",
                    "诺依曼体系结构中，指出计算机处理的数据和指令都是二进制数，采用存储程序方式不加区分的存储在同一个存储器里，并且顺序执行，指令由操作码和地址码组成，操作码决定了操作类型和所操作的数的数字类型，地址码则指出地址码和操作数。",
                    "/uploads/article/thumb/2016071213203123.jpg",
                    "JVM的相关知识整理和学习",
                    "jvm,java",
                    "诺依曼体系结构中，指出计算机处理的数据和指令都是二进制数，采用存储程序方式不加区分的存储在同一个存储器里，并且顺序执行，指令由操作码和地址码组成，操作码决定了操作类型和所操作的数的数字类型，地址码则指出地址码和操作数。",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "0",
                    "1",
                    "1",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468300831",
                    "1476717356",

                ],
                [
                    "22",
                    "2",
                    "0",
                    "关于Java集合的小抄",
                    "",
                    "在尽可能短的篇幅里，将所有集合与并发集合的特征，实现方式，性能捋一遍。适合所有”精通Java”其实还不那么自信的人阅读。",
                    "/uploads/article/thumb/2016071213224495.jpg",
                    "关于Java集合的小抄",
                    "java,java集合",
                    "在尽可能短的篇幅里，将所有集合与并发集合的特征，实现方式，性能捋一遍。适合所有”精通Java”其实还不那么自信的人阅读。",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "0",
                    "2",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468300964",
                    "1476717385",

                ],
                [
                    "23",
                    "0",
                    "2",
                    "关于我们",
                    "about",
                    "",
                    "",
                    "",
                    "",
                    "",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "0",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468309252",
                    "1476717356",

                ],
                [
                    "24",
                    "0",
                    "2",
                    "联系方式",
                    "contact",
                    "",
                    "",
                    "",
                    "",
                    "",
                    "1",
                    "0",
                    "1",
                    "admin",
                    "0",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468309318",
                    "1476717356",

                ],
                [
                    "25",
                    "0",
                    "0",
                    "dfdf",
                    "dfd",
                    "fsafsdfsdf",
                    "",
                    "",
                    "",
                    "",
                    "0",
                    "0",
                    "1",
                    "admin",
                    "0",
                    "0",
                    "1",
                    "1",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "0",
                    "1468898361",
                    "1476717356",

                ],
            ]
        );


        //table article_content
        $this->createTable('{{%article_content}}', [
            'id' => $this->primaryKey()->unsigned()->comment("自增id"),
            'aid' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("文章id"),
            'content' => $this->text()->notNull()->comment("文章详细内容"),
        ], $tableOptions);

        $this->addForeignKey('fk_aid', "{{%article_content}}", "aid", "{{%article}}", "id", "CASCADE", "CASCADE");
        //$this->batchInsert("{{%article_content}}", ['id','aid','content'], require(__DIR__.'/article.php'));
        $contents = require(__DIR__.'/article.php');
        foreach($contents as $v){
            $this->insert("{{%article_content}}", ['aid'=>$v[1], 'content'=>$v[2]]);
        }


        //table article_meta
        $this->createTable('{{%article_meta}}', [
            'id' => $this->primaryKey()->unsigned()->comment("自增id"),
            'aid' => $this->integer()->unsigned()->notNull()->comment("文章id"),
            'key' => $this->string()->defaultValue('')->notNull()->comment("tag名"),
            'value' => $this->text()->notNull()->comment("tag值"),
            'created_at' => $this->integer()->unsigned()->notNull()->comment("创建时间"),
        ], $tableOptions);

        $this->createIndex("index_aid", "{{%article_meta}}", 'aid');
        $this->createIndex("index_key", "{{%article_meta}}", 'key');

        $this->addForeignKey('fk_article_meta_aid', "{{%article_meta}}", "aid", "{{%article}}", "id", "CASCADE", "CASCADE");

        $this->batchInsert("{{%article_meta}}", ['aid','key','value','created_at'],
            [
                ['1','tag','AngularJS',1507514051],
                ['3','tag','Facebook',1507514051],
                ['3','tag','hack',1507514051],
                ['3','tag','php',1507514051],
                ['5','tag','gc',1507514051],
                ['5','tag','垃圾回收',1507514051],
                ['5','tag','java',1507514051],
                ['6','tag','php7',1507514051],
                ['6','tag','php',1507514051],
                ['6','tag','wordpress',1507514051],
                ['8','tag','spring',1507514051],
                ['8','tag','java',1507514051],
                ['9','tag','css',1507514051],
                ['9','tag','重构',1507514051],
                ['10','tag','php',1507514051],
                ['10','tag','分页',1507514051],
                ['11','tag','php脚本',1507514051],
                ['11','tag','下载',1507514051],
                ['11','tag','代码下载',1507514051],
                ['12','tag','java',1507514051],
                ['12','tag','Javascript',1507514051],
                ['12','tag','Lisp',1507514051],
                ['12','tag','php',1507514051],
                ['12','tag','Python',1507514051],
                ['12','tag','Ruby',1507514051],
                ['12','tag','编程语言',1507514051],
                ['12','tag','趣文',1507514051],
                ['13','tag','缓存',1507514051],
                ['13','tag','浏览器缓存',1507514051],
                ['13','tag','http协议',1507514051],
                ['14','tag','javascript',1507514051],
                ['14','tag','流行',1507514051],
                ['15','tag','java',1507514051],
                ['16','tag','java',1507514051],
                ['16','tag','用户界面',1507514051],
                ['17','tag','css',1507514051],
                ['17','tag','样式',1507514051],
                ['18','tag','java',1507514051],
                ['18','tag','入门',1507514051],
                ['18','tag','编程书籍',1507514051],
                ['19','tag','java',1507514051],
                ['19','tag','java8',1507514051],
                ['19','tag','垃圾收集',1507514051],
                ['20','tag','jvm',1507514051],
                ['20','tag','java',1507514051],
                ['21','tag','jvm',1507514051],
                ['21','tag','java',1507514051],
                ['22','tag','java',1507514051],
                ['22','tag','java集合',1507514051],
            ]
        );

        //table content
        $this->createTable('{{%comment}}', [
            'id' => $this->primaryKey()->unsigned()->comment("自增id"),
            'aid' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("文章id"),
            'uid' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("用户id,游客为0"),
            'admin_id' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("管理员id,其他人员对其回复为0"),
            'reply_to' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("回复的评论id"),
            'nickname' => $this->string()->defaultValue('游客')->notNull()->comment("昵称"),
            'email' => $this->string()->defaultValue('')->notNull()->comment("邮箱"),
            'website_url' => $this->string()->defaultValue('')->notNull()->comment("个人网址"),
            'content' => $this->string()->notNull()->comment("回复内容"),
            'ip' => $this->string()->defaultValue('')->notNull()->comment("回复ip"),
            'status' => $this->smallInteger()->unsigned()->defaultValue(0)->notNull()->comment("状态,0.未审核,1.已通过"),
            'created_at' => $this->integer()->unsigned()->notNull()->comment("创建时间"),
            'updated_at' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("最后修改时间"),
        ], $tableOptions);

        $this->addForeignKey('fk_comment_aid', "{{%comment}}", "aid", "{{%article}}", "id", "CASCADE", "CASCADE");

        $this->createIndex("index_aid", "{{%comment}}", "aid");

        $this->batchInsert("{{%comment}}", ['id','aid','uid','reply_to','nickname','email','website_url','content','ip','status','created_at','updated_at'],
            [
                [
                    "1",
                    "12",
                    "0",
                    "0",
                    "aaa",
                    "",
                    "",
                    "你好，世界！",
                    "127.0.0.1",
                    "1",
                    "1476066961",
                    "0",

                ],
                [
                    "2",
                    "22",
                    "0",
                    "0",
                    "aaa",
                    "",
                    "",
                    " :mrgreen:  :roll: 哎哟，不错哟~",
                    "127.0.0.1",
                    "1",
                    "1476066990",
                    "0",

                ],
                [
                    "3",
                    "22",
                    "0",
                    "2",
                    "bbb",
                    "",
                    "",
                    "呵呵哒",
                    "127.0.0.1",
                    "1",
                    "1476067011",
                    "0",

                ],
                [
                    "4",
                    "12",
                    "0",
                    "0",
                    "ccc",
                    "",
                    "",
                    " :shock: ",
                    "127.0.0.1",
                    "1",
                    "1476067042",
                    "0",

                ],
                [
                    "5",
                    "12",
                    "0",
                    "0",
                    "aaa",
                    "",
                    "",
                    "嘻嘻嘻",
                    "127.0.0.1",
                    "1",
                    "1476067060",
                    "0",

                ],
                [
                    "6",
                    "21",
                    "0",
                    "0",
                    "aaa",
                    "",
                    "",
                    "流弊哄哄~~~",
                    "127.0.0.1",
                    "1",
                    "1476067093",
                    "0",

                ],
            ]
        );


        //table friendly_link
        $this->createTable('{{%friendly_link}}', [
            'id' => $this->primaryKey()->unsigned()->comment("自增id"),
            'name' => $this->string()->notNull()->comment("网站名称"),
            'image' => $this->string()->defaultValue('')->notNull()->comment("图片url"),
            'url' => $this->string()->defaultValue('')->notNull()->comment("链接地址"),
            'target' => $this->string()->defaultValue('_blank')->notNull()->comment("打开方式._blank新窗口,_self本窗口"),
            'sort' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("排序"),
            'status' => $this->smallInteger()->unsigned()->defaultValue(0)->notNull()->comment("状态.0禁用,1启用"),
            'created_at' => $this->integer()->unsigned()->notNull()->comment("创建时间"),
            'updated_at' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("最后修改时间"),
        ], $tableOptions);

        $this->batchInsert("{{%friendly_link}}", ['id','name','image','url','target','sort','status','created_at','updated_at'],
            [
                [
                    '1',
                    '飞嗨博客',
                    '',
                    'http://blog.feehi.com',
                    '_blank',
                    '0',
                    '1',
                    '1468303851',
                    '0',
                ],
                [
                    '2',
                    '飞嗨网',
                    '',
                    'http://www.feehi.com',
                    '_blank',
                    '0',
                    '1',
                    '1468303882',
                    '0',
                ],
                [
                    '3',
                    '36kr',
                    '',
                    'http://www.36kr.com',
                    '_blank',
                    '0',
                    '1',
                    '1468303902',
                    '0',
                ],
                [
                    '4',
                    '破晓电影',
                    '',
                    'http://www.poxiao.com',
                    '_blank',
                    '0',
                    '1',
                    '1468303938',
                    '0',
                ],
                [
                    '5',
                    '翠竹林主题',
                    '',
                    'http://www.cuizl.com/',
                    '_blank',
                    '0',
                    '1',
                    '1468303974',
                    '0',
                ],
            ]
        );


        //table menu
        $this->createTable('{{%menu}}', [
            'id' => $this->primaryKey()->unsigned()->comment("自增id"),
            'type' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("菜单类型.0后台,1前台"),
            'parent_id' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("上级菜单id"),
            'name' => $this->string()->notNull()->comment("名称"),
            'url' => $this->string()->notNull()->comment("url地址"),
            'icon' => $this->string()->defaultValue('')->notNull()->comment("图标"),
            'sort' => $this->float()->unsigned()->defaultValue(0)->notNull()->comment("排序"),
            'target' => $this->string()->defaultValue('_blank')->notNull()->comment("打开方式._blank新窗口,_self本窗口"),
            'is_absolute_url' => $this->smallInteger()->unsigned()->defaultValue(0)->notNull()->comment("是否绝对地址"),
            'is_display' => $this->smallInteger()->unsigned()->defaultValue(1)->notNull()->comment("是否显示.0否,1是"),
            'created_at' => $this->integer()->unsigned()->notNull()->comment("创建时间"),
            'updated_at' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("最后修改时间"),
        ], $tableOptions);

        $this->batchInsert("{{%menu}}", ['id','type','parent_id','name','url','icon','sort','target','is_absolute_url','is_display','created_at','updated_at'
            ],
            [
                ['1','0','0','设置','','fa fa-cogs','0','_blank','0','1','1505570067','1505570067'],
                ['2','0','1','网站设置','/setting/website','','1','_blank','0','1','1505570108','1505570108'],
                ['3','0','1','SMTP设置','setting/smtp','','2','_blank','0','1','1505570155','1505570283'],
                ['4','0','1','自定义设置','setting/custom','','4','_blank','0','1','1505570187','1505570187'],
                ['5','0','0','菜单','','fa fa-th-list','2','_blank','0','1','1505570320','1512380045'],
                ['6','0','5','前台菜单','frontend-menu/index','','0','_blank','0','1','1505570366','1505570366'],
                ['7','0','5','后台菜单','menu/index','','0','_blank','0','1','1505570382','1505570382'],
                ['8','0','0','内容','','fa fa-edit','3','_blank','0','1','1505570558','1512380045'],
                ['9','0','8','文章','article/index','','0','_blank','0','1','1505570610','1505570610'],
                ['10','0','8','分类','category/index','','0','_blank','0','1','1505570638','1505570638'],
                ['11','0','8','评论','comment/index','','0','_blank','0','1','1505570661','1505570707'],
                ['12','0','8','单页','page/index','','0','_blank','0','1','1505570687','1505570687'],
                ['13','0','0','用户','user/index','fa fa-users','4','_blank','0','1','1505570745','1512380045'],
                ['14','0','0','权限管理','','fa fa-th-large','5','_blank','0','1','1505570819','1512380045'],
                ['15','0','14','权限','rbac/permissions','','0','_blank','0','1','1505570862','1505570862'],
                ['16','0','14','角色','rbac/roles','','0','_blank','0','1','1505570882','1505570882'],
                ['17','0','14','管理员','admin-user/index','','0','_blank','0','1','1505570902','1505570902'],
                ['18','0','0','友情链接','friendly-link/index','fa fa-link','6','_blank','0','1','1505570934','1512380045'],
                ['19','0','0','缓存','','fa fa-file','7','_blank','0','1','1505570947','1512380045'],
                ['20','0','19','清除前台','clear/frontend','','0','_blank','0','1','1505570974','1505570974'],
                ['21','0','19','清除后台','clear/backend','','0','_blank','0','1','1505570994','1505570994'],
                ['22','0','0','日志','log/index','fa fa-history','8','_blank','0','1','1505571212','1512380045'],
                ['23','1','0','首页','/','','0','_self','0','1','1505636890','1505637024'],
                ['24','1','0','php','/php','','0','_self','0','1','1505636915','1505636937'],
                ['25','1','0','java','/java','','0','_self','0','1','1505636975','1505636975'],
                ['26','1','0','javascript','/javascript','','0','_self','0','1','1505637000','1505637000'],
                ['27','0','0','运营管理','','fa fa-ils','1','_self','0','1','1505637000','1505637000'],
                ['28','0','27','Banner管理','banner/index','','0','_self','0','1','1505637000','1505637000'],
                ['29','0','27','广告管理','ad/index','','0','_self','0','1','1505637000','1505637000'],
            ]
        );


        //table options
        $this->createTable('{{%options}}', [
            'id' => $this->primaryKey()->unsigned()->comment("自增id"),
            'type' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("类型.0系统,1自定义,2banner,3广告"),
            'name' => $this->string()->notNull()->comment("标识符"),
            'value' => $this->text()->notNull()->comment("值"),
            'input_type' => $this->smallInteger()->unsigned()->defaultValue(1)->notNull()->comment("输入框类型"),
            'autoload' => $this->smallInteger()->unsigned()->defaultValue(1)->notNull()->comment("自动加载.0否,1是"),
            'tips' => $this->string()->defaultValue('')->notNull()->comment("提示备注信息"),
            'sort' => $this->integer()->unsigned()->defaultValue(0)->notNull()->comment("排序"),
        ], $tableOptions);

        $this->batchInsert("{{%options}}", ['type','name','value','input_type','tips','autoload','sort'],
            [
                [
                    '0',
                    'seo_keywords',
                    '飞嗨,cms,yii2,php,feehi cms',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'seo_description',
                    'Feehi CMS，最好的cms之一',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'website_title',
                    'Feehi CMS',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'website_description',
                    'Based on most popular php framework yii2',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'website_email',
                    'admin@feehi.com',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'website_language',
                    'zh-CN',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'website_icp',
                    '粤ICP备15018643号',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'website_statics_script',
                    '',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'website_status',
                    '1',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'website_comment',
                    '1',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'website_comment_need_verify',
                    '0',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'website_timezone',
                    'Asia/Shanghai',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'website_url',
                    $frontendUri,
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'smtp_host',
                    '',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'smtp_username',
                    '',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'smtp_password',
                    '',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'smtp_port',
                    '',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'smtp_encryption',
                    '',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '0',
                    'smtp_nickname',
                    '',
                    '1',
                    '',
                    '0',
                    '0',
                ],
                [
                    '1',
                    'weibo',
                    'http://www.weibo.com/feeppp',
                    '1',
                    '新浪微博',
                    '1',
                    '0',
                ],
                [
                    '1',
                    'facebook',
                    'http://www.facebook.com/liufee',
                    '1',
                    'facebook',
                    '1',
                    '0',
                ],
                [
                    '1',
                    'wechat',
                    '飞得更高',
                    '1',
                    '微信',
                    '1',
                    '0',
                ],
                [
                    '1',
                    'qq',
                    '1838889850',
                    '1',
                    'QQ号码',
                    '1',
                    '0',
                ],
                [
                    '1',
                    'email',
                    'admin@feehi.com',
                    '1',
                    '邮箱',
                    '1',
                    '0',
                ],
                ['2', 'index', '[{"sign":"5a251a3013586","img":"\/uploads\/setting\/banner\/5a251a301280d_1.png","target":"_blank","link":"\/view\/11","sort":"3","status":"1","desc":""},{"sign":"5a251a4932a52","img":"\/uploads\/setting\/banner\/5a251a4930fc2_2.jpg","target":"_blank","link":"\/view\/15","sort":"2","status":"1","desc":""},{"sign":"5a251a5690fe9","img":"\/uploads\/setting\/banner\/5a251a568f966_3.jpg","target":"_blank","link":"\/view\/16","sort":"1","status":"1","desc":""}]', '1', '首页banner', '1', '0'],
                ['3', 'sidebar_right_1', '{"ad":"\/uploads\/setting\/ad\/5a292c0fda836_cms.jpg","link":"http://www.feehi.com","target":"_blank","desc":"FeehiCMS","created_at":1512641320,"updated_at":1512647776}', '1', '网站右侧广告位1', '1', '0'],
                ['3', 'sidebar_right_2', '{"ad":"\/uploads\/setting\/ad\/5a291f9236479_22.jpg","link":"","target":"_blank","desc":"\u6700\u597d\u7684\u8fd0\u52a8\u624b\u8868","created_at":1512644498,"updated_at":1512647586}', '1', '网站右侧广告位2', '1', '0'],

            ]
        );

    }

    public function down()
    {
        $this->dropForeignKey('fk_aid', '{{%article_content}}');
        $this->dropForeignKey('fk_article_meta_aid', '{{%article_meta}}');
        $this->dropForeignKey('fk_comment_aid', '{{%comment}}');

        $this->dropIndex('index_key', '{{%article_meta}}');
        $this->dropIndex('index_aid', '{{%article_meta}}');
        $this->dropIndex('index_aid', '{{%comment}}');

        $this->dropTable('{{%options}}');
        $this->dropTable('{{%menu}}');
        $this->dropTable('{{%friendly_link}}');
        $this->dropTable('{{%comment}}');
        $this->dropTable('{{%article_meta}}');
        $this->dropTable('{{%article_content}}');
        $this->dropIndex('index_title', '{{%article}}');
        $this->dropTable('{{%article}}');
        $this->dropTable('{{%category}}');
        $this->dropTable('{{%admin_log}}');
        $this->dropTable('{{%admin_user}}');
        $this->dropTable('{{%user}}');
    }

    public function getParams()
    {
        $rawParams = [];
        if (isset($_SERVER['argv'])) {
            $rawParams = $_SERVER['argv'];
            array_shift($rawParams);
        }

        $params = [];
        foreach ($rawParams as $param) {
            if (preg_match('/^--(\w+)(=(.*))?$/', $param, $matches)) {
                $name = $matches[1];
                $params[$name] = isset($matches[3]) ? $matches[3] : true;
            } else {
                $params[] = $param;
            }
        }
        $return = [];
        foreach ($params as $v){
            if( strpos($v, '=') !== false ) {
                $array = explode('=', $v);
                $return[$array[0]] = $array[1];
            }else{
                $return[$v] = "";
            }
        }
        return $return;
    }
}
